def select_sorted(li):
    for i in range(len(li)):
        min_loc = i
        for j in range(i, len(li)):
            if li[min_loc] > li[j]:
                min_loc = j
        if min_loc != i:
            li[i], l[min_loc] = li[min_loc], li[i]


if __name__ == '__main__':
    l = [3, 4, 1, 5, 9, 2, 7, 8, ]
    select_sorted(l)
    print(l)
